//Sunday, November 01 2009
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class LampsGrid
{
	public:
		int mostLit(vector <string> initial, int K)
		{
			int res = 0;
			for ( int i=0; i<(int)initial.size(); ++i ) {
				int zeros = count(initial[i].begin(), initial[i].end(), '0');
				if ( zeros%2 == K%2 && zeros <= K ) {
					res = max( res, count(initial.begin(), initial.end(), initial[i]) );
				}
			}
			return res;
		}
// 	bool ison(vector<string> initial, int row)
// 	{
// 		for(int i=0; i<initial[row].size(); i++)
// 			if(initial[row][i] == '0')
// 				return false;
// 		return true;
// 	}
};
